//定义用户相关数据的ts类型
//用户登录接口携带参数的ts类型
export interface loginFormData {
    username: string,
    password: string
}

//定义全部接口返回数据都拥有ts类型
export interface ResponseData{
    code:number,
    message:string,
    ok: boolean,
    success: boolean
}

export interface R<T> extends ResponseData{
    data: T
}

//定义登录接口返回数据类型
export interface loginResponseData extends ResponseData{
    data: {
        access_token: string,
        refresh_token: string,
        token_type: string,
        expires_in: string
        
       }
}

//定义获取用户信息返回数据类型
export interface userInfoReponseData extends ResponseData{
    data:{
        routes:string[],
        buttons:string[],
        roles:string[],
        username:string,
        avatar:string
    }
}

//定义获取用户的查询对象
export interface queryUser {
    loginName: string,
    userName: string,
    phoneNumber: string
}


export interface page<D> {
        records: D[],
        total: number,
        size: number,
        pages: number


}


export interface UserResp {
    userId: number;        
    deptId: string | null; 
    loginName: string;     
    userName: string;      
    userType: string;      
    email: string;         
    phone: string;         
    gender: '0' | '1' | '2'; 
    avatar: string;       
    password: string;      
    salt: string;         
    status: '0' | '1';     
    delFlag: '0' | '2';    
    loginIp: string;       
    birthday: string | '';     
    loginDate: string;    
    pwdUpdateDate: string; 
    createBy: string;      
    createTime: string;    
    updateBy: string;      
    updateTime: string;    
    remark: string | null; 
  }

// 查询用户分页返回对象
export interface UserListResponse extends ResponseData{
    data: page<UserResp>

}

/** 分页信息 */
export interface PageInfo {
    pageSize: number;
    pageIndex: number;
    orderBy?: string;
    orderDirection?: 'ASC' | 'DESC';
    groupBy?: string;
    offset?: number;
    needTotalCount?: boolean;
}
  
/** 通用分页请求（泛型） */
export interface PageQuery<T = Record<string, unknown>> {
    filterData: T;
    pageInfo: PageInfo;
}
  
/** 空分页（可选） */
export const emptyPageInfo = (): PageInfo => ({
    pageSize: 10,
    pageIndex: 1,
    needTotalCount: true,
});
  
